function out_total = f_LOOCV(One1_Two2,HRTF_cues,Num_sub)

if One1_Two2 == 1 | One1_Two2 == 3
    vectors = HRTF_cues{1}; % Binaural cues only
    [Nrow Ncol]=size(vectors);
    CM = zeros(length(vectors),length(vectors));
    for isub = 1:Num_sub
        isub
        for irow = 1:Nrow
            for icol = 1:Ncol
                All_testing{irow,icol} = vectors{irow,icol}(isub,:);
                ALL_vectors_training{irow,icol} = vectors{irow,icol};
                ALL_vectors_training{irow,icol}(isub,:) = [];
            end
        end
%         'here'
% size(ALL_vectors_training)
        out = f_lda_training_testing_diff(ALL_vectors_training,All_testing);
%         out = f_ANN_training_testing_diff(ALL_vectors_training,All_testing);
%         out = f_SNN_training_testing_diff(ALL_vectors_training,All_testing);
        CM = CM+out.CM;
    end
else % 2 step
    
    vectors_B = HRTF_cues{1}; % Binaural
    vectors_M = HRTF_cues{2}; % Monaural
    [Nrow Ncol]=size(vectors_B);
    CM = zeros(length(vectors_B),length(vectors_B));
    for isub = 1:Num_sub
        isub
        for irow = 1:Nrow
            for icol = 1:Ncol
                Binaural_testing{irow,icol} = vectors_B{irow,icol}(isub,:);
                Binaural_training{irow,icol} = vectors_B{irow,icol};
                Binaural_training{irow,icol}(isub,:) = [];
            end
        end
    end
    [Nrow Ncol]=size(vectors_M);
    CM = zeros(Nrow*Ncol,Nrow*Ncol);
    for isub = 1:Num_sub
        isub
        for irow = 1:Nrow
            for icol = 1:Ncol
                Monaural_testing{irow,icol} = vectors_M{irow,icol}(isub,:);
                Monaural_training{irow,icol} = vectors_M{irow,icol};
                Monaural_training{irow,icol}(isub,:) = [];
            end
        end
        
        out =  f_lda_2steps(Binaural_training,Binaural_testing,Monaural_training,Monaural_testing);
        
        %out =  f_lda_2steps(ALL_vectors_training_B,ALL_testing_B,ALL_vectors_testing_M,ALL_testing_M)
        CM = CM+out.CM;
    end
end
out_total.CM = CM;
out_total.PC = sum(diag(CM))./sum(sum(CM))